package com.dongdongshop.config;

import com.aliyun.teaopenapi.models.Config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class AliyunConfig {

    @Value("${aliyun.accessKeyId}")
    private String accessKeyId;

    @Value("${aliyun.accessKeySecret}")
    private String accessKeySecret;

    @Bean
    public com.aliyun.dysmsapi20170525.Client createClient() throws Exception{
        Config config = new Config()
                //您的accessKey  Id
                .setAccessKeyId(accessKeyId)
                //accessKey  Secret
                .setAccessKeySecret(accessKeySecret);
        //访问的域名
        config.endpoint = "dysmsapi.aliyuncs.com";
        return new com.aliyun.dysmsapi20170525.Client(config);
    }
}
